package com.rftennis.vo;

import java.time.format.DateTimeFormatter;

import com.rftennis.entity.CustomerEntity;
import com.rftennis.entity.OrderEntity;
import com.rftennis.entity.OrderItemEntity;
import com.rftennis.entity.ProductEntity;

import lombok.Data;
@Data
public class OrderItemVo {
	private String id;//订单详情编号
	private String product;//订单里每个项目所对应的商品id
	private String productId;//订单里每个项目所对应的商品id
	private String productPropertys;//商品对应的属性
	private String status;//商品对应的属性
    private String price;//商品的价格(单价)
	private String amount;//商品的个数
	private String orderNo;//订单编号
	private String orderId;//商品项目所属订单Id
	public static OrderItemVo of(OrderItemEntity e) {
		OrderItemVo vo=new OrderItemVo();
		vo.setAmount(e.getAmount());
		vo.setId(e.getId());
		vo.setOrderNo(e.getOrder().getOrdNo());
		vo.setOrderId(e.getOrder().getId());
		vo.setPrice(e.getPrice());
		//vo.setProduct(e.getProduct().getName());
		vo.setProductPropertys(e.getProductPropertys());
		int a = Integer.parseInt(e.getOrder().getStatus());
		String status;
		if(a==1) {
			status="待收货";
		}else {
			status="已收货";
		}
		vo.setStatus(status);
		return vo;
	}
	@Override
	public String toString() {
		return "OrderItemVo [id=" + id + ", product=" + product + ", productId=" + productId + ", productPropertys="
				+ productPropertys + ", status=" + status + ", price=" + price + ", amount=" + amount + ", orderNo="
				+ orderNo + ", orderId=" + orderId + "]";
	}

	
	
}
